package one.chchy.demo.sprintsecurity;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;

/**
 * Created by lutery on 2017/8/11.
 */
public class JwtUser implements UserDetails {

    private String mUserName;
    private String mPassword;
    private Collection<? extends GrantedAuthority> mAuthorities;

    public JwtUser(String username, String password, Collection<? extends GrantedAuthority> authorities){
        mUserName = username;
        mPassword = password;
        mAuthorities = authorities;
    }

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return mAuthorities;
    }

    @Override
    public String getPassword() {
        return mPassword;
    }

    @Override
    public String getUsername() {
        return mUserName;
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }
}
